//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<colorbuf.cpp>
///	@path	~/src/graphics/ximage/
///	@date	2008/04/20
///	@desc	.

#include "config/config.h"

#include "graphics/ximage/colorbuf.h"

namespace xeres {

	// ColorBuf
	ColorBuf::ColorBuf( size_t width , size_t height )
		: m_width( width )
		, m_height( height )
		, m_buf( NULL )
	{
		m_buf = (uint32*)_aligned_malloc( m_width * m_height * sizeof(uint32) , 16 );
		Clear();
	}
	// ~ColorBuf
	ColorBuf::~ColorBuf( void )
	{
		_aligned_free( m_buf );
	}
	// Clear
	void ColorBuf::Clear( void )
	{
		memset( m_buf , 0 , m_width * m_height * sizeof(uint32) );
	}
	// Clear
	void ColorBuf::Clear( const PackColor4& color )
	{
		uint32 col = color.get_packed_argb();
		for( size_t i = 0 , total = m_width * m_height ; i < total ; ++i )
			m_buf[ i ] = col;
	}
	// Composite
	void ColorBuf::Composite( const ColorBuf& overlay , const Pair<int>& pos /*= Pair<int>(0,0) */ )
	{

	}
	// Blend
	void ColorBuf::Blend( const ColorBuf& a , const ColorBuf& b , const Pair<int>& pos /*= Pair<int>(0,0) */ )
	{

	}
	// Blend
	void ColorBuf::Blend( const ColorBuf& a , const PackColor4& alpha , const Pair<int>& pos /*= Pair<int>(0,0) */ )
	{

	}
	// Write
	void ColorBuf::Write( const ColorBuf& target , const Pair<int>& pos /*= Pair<int>(0,0) */ )
	{

	}
	// InvertColor
	void ColorBuf::InvertColor( bool with_alpha /*= false */ )
	{

	}

} // namespace xeres
